﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="StockGraph.aspx.cs" Inherits="WebTraderLite.Pages.StockGraph" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     <ajaxToolkit:ToolkitScriptManager ID="sm" runat="server"></ajaxToolkit:ToolkitScriptManager>

   <div>       
            <span class="failureNotification">
                <asp:Literal ID="FailureText" runat="server"></asp:Literal>
            </span>
            <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification" 
                 ValidationGroup="GraphValidationGroup"/> 
    
        <table id="tableLayout1" width="50%"  style="white-space:nowrap">
            <tr>
                <td>                    
                Stock symbol:                     
                </td>
                
                <td>
                <asp:TextBox ID="tbStock" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="StockSymRequired" runat="server" ControlToValidate="tbStock" 
                        CssClass="failureNotification" ErrorMessage="Stock symbol is required." 
                        ValidationGroup="GraphValidationGroup">*</asp:RequiredFieldValidator>
                </td>

                <td colspan="3">
                <!-- Placeholder to hold label control to display a message if stock symbol not found -->
                <asp:PlaceHolder ID="phFailSearch" runat="server"></asp:PlaceHolder>
                </td>
            </tr>
            <tr>
                <td>
                From date: 
                </td>

                <td>
                <asp:TextBox ID="tbBeginDate" runat="server" CausesValidation="True"></asp:TextBox>
                <ajaxToolkit:CalendarExtender ID="calendarExtendBegDate" runat="server" TargetControlID="tbBeginDate"></ajaxToolkit:CalendarExtender>
                
                <asp:RequiredFieldValidator ID="BegDateRequired" runat="server" ControlToValidate="tbBeginDate" 
                        CssClass="failureNotification" ErrorMessage="Begin date is required." 
                        ValidationGroup="GraphValidationGroup" EnableClientScript="true">*</asp:RequiredFieldValidator>

                <asp:CompareValidator ID="CompareDateBeg" runat="server" ControlToValidate="tbBeginDate"
                         CssClass="failureNotification" ErrorMessage="Enter valid date format mm/dd/yyyy for begin date" 
                         ValidationGroup="GraphValidationGroup" Type="Date" Operator="DataTypeCheck">*</asp:CompareValidator>

                </td>
                
                <td>
                To date:
                </td>

                <td>
                 <asp:TextBox ID="tbEndDate" runat="server" CausesValidation="True"></asp:TextBox>
                <ajaxToolkit:CalendarExtender ID="calendarExtendEndDate" runat="server" TargetControlID="tbEndDate"></ajaxToolkit:CalendarExtender>
                
                <asp:RequiredFieldValidator ID="EndDateRequired" runat="server" ControlToValidate="tbEndDate" 
                        CssClass="failureNotification" ErrorMessage="End date is required." 
                        ValidationGroup="GraphValidationGroup">*</asp:RequiredFieldValidator>                

                <asp:CompareValidator ID="CompareDateEnd" runat="server" ControlToValidate="tbEndDate"
                         CssClass="failureNotification" ErrorMessage="Enter valid date format mm/dd/yyyy for end date" 
                         ValidationGroup="GraphValidationGroup" Type="Date" Operator="DataTypeCheck">*</asp:CompareValidator>

                <!--Valid date range check-->
                <asp:CompareValidator ID="CompareDateRange" ControlToCompare="tbBeginDate" ControlToValidate="tbEndDate" Type="Date" Operator="GreaterThanEqual"  
                        CssClass="failureNotification" ErrorMessage="To Date should be greater than From Date" runat="server" 
                        Display="Dynamic" EnableClientScript="true" ValidationGroup="GraphValidationGroup">*</asp:CompareValidator>
                
                </td>

                <td>
                <asp:Button ID="btnGraph" runat="server" Text="Graph History" ValidationGroup="GraphValidationGroup" 
                        onclick="btnGraph_Click" />
                </td>
            </tr>
        </table>

   <br />   
    
   </div>
    
    
   <div> 

   <br />  
    <asp:Chart ID="stockChart" runat="server" Width="912px" Height="448px">
        <series>
            <asp:Series ChartType="Line" Name="seriesPriceHistory" YValueType="Single" XValueType="DateTime" ChartArea="chartAreaPriceHistory">
            </asp:Series>

            <asp:Series ChartType="Column" Name="seriesVolHistory" YValueType="Single" XValueType="DateTime" ChartArea="chartAreaVolume">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea Name="chartAreaPriceHistory">
            </asp:ChartArea>

            <asp:ChartArea Name="chartAreaVolume">
            </asp:ChartArea>
        </chartareas>
    </asp:Chart>

    </div>
</asp:Content>
